/**
 * Created by nitin on 3/24/14.
 */
function CoverCtrl($scope, $timeout) {
    $scope.coverList = [
        {value: 'background-image:url("img/cover/a0.jpg");', link: "#"},
        {value: 'background-image:url("img/cover/a1.jpg");', link: "#"},
        {value: 'background-image:url("img/cover/a2.jpg");', link: "#"},
        {value: 'background-image:url("img/cover/a3.jpg");', link: "#"},
        {value: 'background-image:url("img/cover/a4.jpg");', link: "#"}
    ];
    $scope.coverCurrent = 0;
    $scope.coverSelect = function () {
        $scope.coverCurrent = this.$index;
    };

    var duration = 3000;

    var slideTimer =
        $timeout(function interval() {
            $scope.coverCurrent = $scope.coverCurrent++ < $scope.coverList.length-1 ? $scope.coverCurrent : 0;
            slideTimer = $timeout(interval, duration);
        }, duration);
}